#include "CmdClient.h"
#include "CmdHandler.h"
#include "Utils.h"

CmdClient::CmdClient(uv_tcp_t* client)
	: UvClient(client, 1000)
{
	m_Filter = 0;
	m_Parser.SetOnPacket(this);
}

CmdClient::~CmdClient()
{
}

void CmdClient::OnRead(char* pData, int length)
{
	m_Parser.Parse((byte*)pData, length);
}

void CmdClient::OnPacket(Packet* pPacket)
{
	CmdHandler::Instance()->Handle(this, pPacket);
}

void CmdClient::SetFilter(int filter)
{
	m_Filter = filter;
}

int CmdClient::GetFilter()
{
	return m_Filter;
}
